<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="UTF-8">
        {% if title %}
        <title>{{ _(title) }} - microblog</title>
        {% else %}
        <title>{{ _("Welcome to") }}  - microblog</title>
        {% endif %}
        <!-- ZUI 标准版压缩后的 CSS 文件 -->
        <link type="text/css" rel="stylesheet" href="/static/plugins/zui/css/zui.min.css" />
        <!-- 系统样式的 CSS 文件 -->
        <link type="text/css" rel="stylesheet" href="/static/css/main.css" />
        <script type="text/javascript" src="/static/js/jquery-3.3.1.js"></script>
        <!-- ZUI 标准版压缩后的 JavaScript 文件 -->
        <script type="text/javascript" src="/static/plugins/zui/js/zui.min.js"></script>
        <!-- Moment JS -->
        <script type="text/javascript" src="/static/js/moment-with-locales.js"></script>
    </head>
    <body>
        <ul class="nav nav-secondary">
            <li class="nav-heading"><i class="icon icon-chanzhi-pro"> Microblog</i></li>
            {% if g.user.is_authenticated() %}
            <li id="home"><a href="/index"><i class="icon icon-home"> {{ _("Home") }}</i></a></li>
            <li><a href="{{ url_for('user', nickname = g.user.nickname) }}"><i class="icon icon-user"> {{ _("Your Profile") }}</i></a></li>
            <li><a href="/article"><i class="icon icon-newspaper-o"> {{ _("Article") }}</i></a></li>
            <li><a href="{{ url_for('logout') }}"><i class="icon icon-signout"> {{ _("Logout") }}</i></a></li>
            <li>
                <!-- 导航中的表单 -->
                <form class="navbar-form navbar-left" role="search" action="{{url_for('search')}}" method="post">
                    <div class="form-group">
                        {{g.search_form.hidden_tag()}}
                        <input type="text" name="search" class="form-control" placeholder="{{ _('search') }}">
                    </div>
                    <button type="submit" class="btn btn-default"><i class="icon icon-search"> {{ _("search") }}</i></button>
                </form>
            </li>
            {% else %}
            <li class="active"><a href="/user/login"><i class="icon icon-location-arrow"> {{ _("Login") }}</i></a></li>
            {% endif %}
        </ul>

        {% with messages = get_flashed_messages() %}
            {% if messages %}
            <ul>
                {% for message in messages %}
                <li>{{ message }}</li>
                {% endfor %}
            </ul>
            {% endif %}
        {% endwith %}
        {% block content %}{% endblock %}
    </body>

    <script type="text/javascript" src="/static/js/main.js"></script>
</html>